package com.zhenwei.zscm;

import com.zhenwei.zscm.common.ApiInfoScanner;
import com.zhenwei.zscm.job.ClearUnusedFileJob;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication
@EnableTransactionManagement
@EnableAsync
public class ZhenweiSalesControlManagementApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ZhenweiSalesControlManagementApplication.class, args);
        // 清理无效文件的job
        ClearUnusedFileJob clearUnusedFileJob = context.getBean(ClearUnusedFileJob.class);
        clearUnusedFileJob.run();
        // 扫描程序里的API接口
        ApiInfoScanner apiInfoScanner = context.getBean(ApiInfoScanner.class);
        apiInfoScanner.scanAndSyncApiInfo();
    }

}
